locals {
  css_groups = {
    myapp = {
      cluster_name    = "css-myapp-dev"
      cluster_version = "7.10.2"
      cluster_flavor  = "ess.spec-4u8g"
      instance_count  = 3
      volume_type     = "ULTRAHIGH"
      value_size      = "40"
      ava_zone        = "${var.REGION}a"
      vpc_id          = data.terraform_remote_state.vpc.outputs.vpc_info.id
      subnet_id       = data.terraform_remote_state.subnet.outputs.subnet_info["subnet-me212-dev-baidu_hub-db-elasticsearch"].id
      vsg_id          = data.terraform_remote_state.vsg.outputs.vsg_info.vsg_elasticsearch.vsg_id
    }
  }
}

module "css" {
  source                = "../../../modules/css"
  for_each              = local.css_groups
  cluster_name          = each.value.cluster_name
  cluster_version       = each.value.cluster_version
  cluster_flavor        = each.value.cluster_flavor
  instance_count        = each.value.instance_count
  volume_type           = each.value.volume_type
  value_size            = each.value.value_size
  ava_zone              = each.value.ava_zone
  vpc_id                = each.value.vpc_id
  subnet_id             = each.value.subnet_id
  vsg_id                = each.value.vsg_id
  enterprise_project_id = var.PROJECT_ID
}
